'use strict';
var api = {
    baseUri: (function () {
        let uri;
        if (!window.location.origin)
            uri = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : '');
        uri = window.location.origin;
        if (uri.indexOf('localhost') > 0 || uri.indexOf('127.0.0.1') > 0) //本地环境
            uri = 'http://139.224.13.75:18080';
        return 'http://139.196.255.202:18080';
    })(),

    /**
     * 获取天气情况
     * @name 站点名称
     * @fn 成功回调
     */
    getWeather: function (name, fn) {
        $.weather(name, fn, function () {
            console.log('获取天气接口异常');
        });
    },

    /**
     * 获取指数
     * @id 站点编号 
     * @fn 成功回调 
     */
    getPoint: function (id, fn) {
        $.ajaxGet(this.baseUri + '/air/getAirPointByFsiteNo', { fsiteNo: id }, function (d) {
            if (fn) fn(d);
        });
    },

    getSite: function (id, fn) {
        $.ajaxGet(this.baseUri + '/air/getAirPointByFpointNo', { fsiteNo: id }, function (d) {
            if (fn) fn(d);
        });
    },

    getSite2: function (id, fn) {
        if (fn) fn({
            "fpointNo": null,
            "faqi": 1,
            "fupddate": "2024-12-10T02:01:01.804+0000",
            "fcontaminants": "二氧化碳",
            "wd": null,
            "sd": null,
            "fmoniterPm25": null,
            "fmoniterPm10": null,
            "fyx": "空气质量令人满意，基本无空气污染",
            "fcs": "各类人群可正常活动"
          });
    },


    /**
     * 获取AQI
     * @param {站点} id 
     * @param {用户编号} userId 
     * @param {回调函数} fn 
     */
    getAQIByUserId: function (id, userId, fn) {
        $.ajaxGet(api.baseUri + '/air/getAQIByUserId', {
            fsiteParent: id,
            userId: userId,
        }, function (d) {
            if (fn) fn(d);
        });
    },

    /**
     * 获取 24小时 AQL
     * @id 站点编号
     * @fn 成功回调 
     */
    getAqifor24: function (id, fn) {
        $.ajaxGet(this.baseUri + '/air/getAQIByFsiteNo', { fsiteNo: id }, function (d) {
            if (fn) fn(d.list.reverse());
        });
    },

    getsiteAqifor24: function (id, fn) {
        $.ajaxGet(this.baseUri + '/air/getAQIByFpointNo', { fsiteNo: id }, function (d) {
            if (fn) fn(d.list.reverse());
        });
    },

    getsiteAqi2: function (id, fn) {
        var data={
            "list": [
              {
                "fsiteName": null,
                "fpointNo": null,
                "fpointName": null,
                "fhour": 0,
                "fpm26": null,
                "fpm25": 0,
                "fpm10": 0,
                "fco2": 503,
                "fjq": 0.007,
                "fyjw": 0.044,
                "fwd2": 17.25,
                "fsd2": 47.38
              },
              {
                "fsiteName": null,
                "fpointNo": null,
                "fpointName": null,
                "fhour": 1,
                "fpm26": null,
                "fpm25": 0,
                "fpm10": 0,
                "fco2": 490,
                "fjq": 0.008,
                "fyjw": 0.045,
                "fwd2": 17.25,
                "fsd2": 47.76
              },
              {
                "fsiteName": null,
                "fpointNo": null,
                "fpointName": null,
                "fhour": 2,
                "fpm26": null,
                "fpm25": 0,
                "fpm10": 0,
                "fco2": 482,
                "fjq": 0.007,
                "fyjw": 0.044,
                "fwd2": 17.25,
                "fsd2": 48.38
              },
              {
                "fsiteName": null,
                "fpointNo": null,
                "fpointName": null,
                "fhour": 3,
                "fpm26": null,
                "fpm25": 0,
                "fpm10": 0,
                "fco2": 471,
                "fjq": 0.007,
                "fyjw": 0.042,
                "fwd2": 17.25,
                "fsd2": 48.77
              },
              {
                "fsiteName": null,
                "fpointNo": null,
                "fpointName": null,
                "fhour": 4,
                "fpm26": null,
                "fpm25": 0,
                "fpm10": 0,
                "fco2": 462,
                "fjq": 0.007,
                "fyjw": 0.043,
                "fwd2": 17.25,
                "fsd2": 48.93
              },
              {
                "fsiteName": null,
                "fpointNo": null,
                "fpointName": null,
                "fhour": 5,
                "fpm26": null,
                "fpm25": 0,
                "fpm10": 0,
                "fco2": 456,
                "fjq": 0.007,
                "fyjw": 0.042,
                "fwd2": 17.25,
                "fsd2": 48.68
              },
              {
                "fsiteName": null,
                "fpointNo": null,
                "fpointName": null,
                "fhour": 6,
                "fpm26": null,
                "fpm25": 0,
                "fpm10": 0,
                "fco2": 450,
                "fjq": 0.007,
                "fyjw": 0.042,
                "fwd2": 17.25,
                "fsd2": 48.66
              },
              {
                "fsiteName": null,
                "fpointNo": null,
                "fpointName": null,
                "fhour": 7,
                "fpm26": null,
                "fpm25": 0,
                "fpm10": 0,
                "fco2": 433,
                "fjq": 0.006,
                "fyjw": 0.042,
                "fwd2": 17,
                "fsd2": 49.44
              },
              {
                "fsiteName": null,
                "fpointNo": null,
                "fpointName": null,
                "fhour": 8,
                "fpm26": null,
                "fpm25": 0,
                "fpm10": 0,
                "fco2": 515,
                "fjq": 0.006,
                "fyjw": 0.047,
                "fwd2": 17.75,
                "fsd2": 49.79
              }
            ]
          }
        if (fn) fn(data.list.reverse());
    },

    /**
     * 获取 设备状态
     * @id 站点编号
     * @fn 成功回调
     */
    getDeviceStatus: function (id, fn) {
        $.ajaxGet(this.baseUri + '/air/getStateByFsiteNo', { fsiteNo: id }, function (d) {
            if (fn) {
                var total = 0;
                var data = {};
                data.list = d.list.map(function (item) {
                    total += item.f;
                    return {
                        name: item.fnewWork,
                        value: item.f
                    };
                });
                data.total = total;
                fn(data);
            }
        });
    },

    /**
     * 获取室外AQI数据
     * @id 站点编号 
     * @fn 成功回调
     */
    getOutdoorAQI: function (id, fn) {
        $.ajaxGet(this.baseUri + '/air/getStationBYFsiteNo', { fsiteNo: id, fpointFlag: 1 }, function (d) {
            if (fn) fn(d.list);
        });
    },
    /**
     * 获取室内总站AQI数据
     * @id 站点编号 
     * @fn 成功回调
     */
    getMainIndoorAQI: function (id, fn) {
        $.ajaxGet(this.baseUri + '/air/getStationBYFsiteNo', { fsiteNo: id, fpointFlag: 2 }, function (d) {
            if (fn) fn(d.list);
        });
    },

    /**
     *  获取室外明细数据
     * @id 站点编号 
     * @fn 成功回调
     */
    getAirDataOutdoor: function (id, fn) {
        $.ajaxGet(this.baseUri + '/air/getAirDataOutdoorByFpointNo', { fpointNo: id }, function (d) {
            if (fn) fn(d.list.reverse());
        });
    },

    /**
     * 获取室内明细数据
     * @id 站点编号 
     * @fn 成功回调
     */
    getDataIndoor: function (id, fn) {
        if (fn) fn({
            "list": [
              {
                "fpointName": "YZ3号楼102教室",
                "fpointNo": "300020101001",
                "fwd": "23.180",
                "fsd": "41.450",
                "fmoniterPm25": "0.011",
                "fmoniterPm10": "0.012",
                "fmoniterCo2": "723.000",
                "fmoniterJq": "0.031",
                "fmoniterYjw": "0.020",
                "no2": null,
                "so2": null,
                "co": "0",
                "o3": null,
                "pm1": "0.00",
                "faqi": 0,
                "fpointH": 0,
                "fpointW": 0,
                "fpointL": 0,
                "fpointD": 0,
                "ftime": "09:01:01",
                "fequipmentbarcode": null,
                "fmacno": null,
                "fequipmenttag": null,
                "fnewwork": "联网",
                "time": "09:01:01"
              },
              {
                "fpointName": "YZ3号楼110教室",
                "fpointNo": "300020101002",
                "fwd": "20.220",
                "fsd": "49.740",
                "fmoniterPm25": "0.001",
                "fmoniterPm10": "0.001",
                "fmoniterCo2": "1242.000",
                "fmoniterJq": "0.020",
                "fmoniterYjw": "0.020",
                "no2": null,
                "so2": null,
                "co": "0",
                "o3": null,
                "pm1": "0.00",
                "faqi": 0,
                "fpointH": 0,
                "fpointW": 0,
                "fpointL": 0,
                "fpointD": 0,
                "ftime": "09:01:01",
                "fequipmentbarcode": null,
                "fmacno": null,
                "fequipmenttag": null,
                "fnewwork": "联网",
                "time": "09:01:01"
              },
              {
                "fpointName": "YZ3号楼203教室",
                "fpointNo": "300020101011",
                "fwd": "16.600",
                "fsd": "51.990",
                "fmoniterPm25": "0.009",
                "fmoniterPm10": "0.009",
                "fmoniterCo2": "593.000",
                "fmoniterJq": "0.011",
                "fmoniterYjw": "0.020",
                "no2": null,
                "so2": null,
                "co": "0",
                "o3": null,
                "pm1": "0.00",
                "faqi": 0,
                "fpointH": 0,
                "fpointW": 0,
                "fpointL": 0,
                "fpointD": 0,
                "ftime": "09:01:01",
                "fequipmentbarcode": null,
                "fmacno": null,
                "fequipmenttag": null,
                "fnewwork": "联网",
                "time": "09:01:01"
              },
              {
                "fpointName": "YZ3号楼209教室",
                "fpointNo": "300020101012",
                "fwd": "16.150",
                "fsd": "52.050",
                "fmoniterPm25": "0.019",
                "fmoniterPm10": "0.020",
                "fmoniterCo2": "476.000",
                "fmoniterJq": "0.006",
                "fmoniterYjw": "0.020",
                "no2": null,
                "so2": null,
                "co": "0",
                "o3": null,
                "pm1": "0.00",
                "faqi": 0,
                "fpointH": 0,
                "fpointW": 0,
                "fpointL": 0,
                "fpointD": 0,
                "ftime": "09:01:01",
                "fequipmentbarcode": null,
                "fmacno": null,
                "fequipmenttag": null,
                "fnewwork": "联网",
                "time": "09:01:01"
              },
              {
                "fpointName": "YZ3号楼305教室",
                "fpointNo": "300020101021",
                "fwd": "16.550",
                "fsd": "52.040",
                "fmoniterPm25": "0.008",
                "fmoniterPm10": "0.009",
                "fmoniterCo2": "676.000",
                "fmoniterJq": "0.002",
                "fmoniterYjw": "0.020",
                "no2": null,
                "so2": null,
                "co": "0",
                "o3": null,
                "pm1": "0.00",
                "faqi": 0,
                "fpointH": 0,
                "fpointW": 0,
                "fpointL": 0,
                "fpointD": 0,
                "ftime": "09:01:01",
                "fequipmentbarcode": null,
                "fmacno": null,
                "fequipmenttag": null,
                "fnewwork": "联网",
                "time": "09:01:01"
              },
              {
                "fpointName": "YZ3号楼313教室",
                "fpointNo": "300020101022",
                "fwd": "18.550",
                "fsd": "53.000",
                "fmoniterPm25": "0.007",
                "fmoniterPm10": "0.009",
                "fmoniterCo2": "1336.000",
                "fmoniterJq": "0.019",
                "fmoniterYjw": "0.020",
                "no2": null,
                "so2": null,
                "co": "0",
                "o3": null,
                "pm1": "0.00",
                "faqi": 0,
                "fpointH": 0,
                "fpointW": 0,
                "fpointL": 0,
                "fpointD": 0,
                "ftime": "09:01:01",
                "fequipmentbarcode": null,
                "fmacno": null,
                "fequipmenttag": null,
                "fnewwork": "联网",
                "time": "09:01:01"
              },
              {
                "fpointName": "YZ3号楼403教室",
                "fpointNo": "300020101031",
                "fwd": "17.130",
                "fsd": "53.320",
                "fmoniterPm25": "0.023",
                "fmoniterPm10": "0.024",
                "fmoniterCo2": "937.000",
                "fmoniterJq": "0.001",
                "fmoniterYjw": "0.020",
                "no2": null,
                "so2": null,
                "co": "0",
                "o3": null,
                "pm1": "0.00",
                "faqi": 0,
                "fpointH": 0,
                "fpointW": 0,
                "fpointL": 0,
                "fpointD": 0,
                "ftime": "09:01:01",
                "fequipmentbarcode": null,
                "fmacno": null,
                "fequipmenttag": null,
                "fnewwork": "联网",
                "time": "09:01:01"
              },
              {
                "fpointName": "YZ3号楼411教室",
                "fpointNo": "300020101032",
                "fwd": "14.960",
                "fsd": "51.970",
                "fmoniterPm25": "0.002",
                "fmoniterPm10": "0.005",
                "fmoniterCo2": "548.000",
                "fmoniterJq": "0.010",
                "fmoniterYjw": "0.020",
                "no2": null,
                "so2": null,
                "co": "0",
                "o3": null,
                "pm1": "0.00",
                "faqi": 0,
                "fpointH": 0,
                "fpointW": 0,
                "fpointL": 0,
                "fpointD": 0,
                "ftime": "09:01:01",
                "fequipmentbarcode": null,
                "fmacno": null,
                "fequipmenttag": null,
                "fnewwork": "联网",
                "time": "09:01:01"
              }
            ]
          });
    },


    // 获取教学楼设备http://139.224.13.75:18080/smartPhone/getEqtInvByFpointNo?fpointNo=60103205

    equipmentInvlists: function (fpointNo, fn) {
        $.ajaxGet(api.baseUri + '/equipment/equipmentInv/list', { fpointNo: fpointNo, fequipmenttype:7}, function (d) {
            if (fn) fn(d.list);
        });
    },
    /**
     * 
     * @id 站点编号
     * @userid 登陆用户
     * @fn 成功回调
     */
    getWarningInfo: function (id, userid, fn) {
        $.ajaxGet(this.baseUri + '/smartPhone/getWarningInfo', {
            eqtType: 0, //0-大屏/1-手机
            fsiteNo: id,
            seq: 0,
            userId: userid
        }, function (d) {
            if (d) {
                if (fn) fn(d.list);
            } else {
                if (fn) fn(d);
            }

        });
    },
    /**
     * 获取数据
     * @param {站点编号} id 
     * @param {回调函数} fn 
     */
    getOftenAirAqiByFsiteNo: function (id, fn) {
        $.ajaxGet(this.baseUri + '/smartPhone/getOftenAirAqiByFsiteNo', { fsiteNo: id }, function (d) {
            if (fn) fn(d.list);
        });
    },

    /**
     * 根据教室编号获取数据
     * @param {教室编号} id 
     */
    getAqiByFpointNo: function (id, fn) {
        $.ajaxGet(this.baseUri + '/smartPhone/getAqiByFpointNo', { fpointNo: id }, function (d) {
            if (fn) fn(d.list);
        });
    },

    /**
     * 获取空气详细数据
     * @param {编号} id 
     * @param {回调} fn 
     */
    getAirDataByFsiteNo: function (id, fn) {
        $.ajaxGet(this.baseUri + '/air/getAirDataByFsiteNo', { fsiteNo: id }, function (d) {
            if (fn) fn(d.list);
        });
    },

    /**
     * 获取室内总站统计
     * @param {站点编号} id 
     * @param {调回回调} fn 
     */
    getPointDataByFsiteNo: function (id, fn) {
        $.ajaxGet(this.baseUri + '/air/getPointDataByFsiteNo', { fsiteNo: id }, function (d) {
            if (fn) fn(d.list);
        });
    },


    /**
     * 获取站点噪音数据
     * @param {站点编号} id 
     * @param {调回回调} fn 
     */
    getNoiseByFsiteNo: function (id, fn) {
        $.ajaxGet(this.baseUri + '/air/getNoiseByFsiteNo', { fsiteNo: id }, function (d) {
            if (fn) fn(d);
        });
    },

    /**
     * 获取空气盒子状态
     * @param {站点编号} id 
     * @param {状态类型} status 
     * @param {调回回调} fn 
     */
    getAirBoxListByStatus: function (id, status, fn) {
        $.ajaxGet(this.baseUri + '/air/getAirBoxListByStatus', { fsiteNo: id, status: status }, function (d) {
            if (fn) fn(d.list);
        });
    },
};


/**************************************公共函数***************************************/

/**
 * 保存数据
 * @param {存储key} key 
 * @param {存储数据} data 
 */
function setStorage(key, data) {
    sessionStorage.setItem(key, JSON.stringify(data));
}

/**
 * 保存数据
 * @param {存储key} key 
 */
function getStorage(key) {
    return JSON.parse(sessionStorage.getItem(key));
}

/**
 * 根据序号获取指数颜色
 * @index 序号
 */
function getColor(index) {
    var colorList = ['#00e400', '#ffff00', '#ff7e00', '#ff0000', '#99004c', '#7e0023'];
    return colorList[index];
};

function getColoropacity(index) {
    var colorList = ['rgba(0,228,0,0.9)', 'rgba(255,255,0,0.9)', 'rgba(255,126,0,0.9)', 'rgba(255,0,0,0.9)', 'rgba(153,0,76,0.9)', 'rgba(126,0,35,0.9)'];
    return colorList[index];
};

function getColoropacitys(index) {
    var colorList = ['rgba(0,228,0,0.2)', 'rgba(255,235,59,0.2)', 'rgba(255,126,0,0.2)', 'rgba(255,0,0,0.2)', 'rgba(153,0,76,0.2)', 'rgba(126,0,35,0.2)'];
    return colorList[index];
};
/**
 * 获取描述
 * @index  序号
 */
function getAqiDes(index) {
    var ds = ['优', '良', '轻度', '中度', '重度', '严重'];
    return ds[index];
};

/**
 * 根据 AQI 值 获取指数
 * @param {根据} aqi 
 */
function getAqiIndex(aqi) {
    var index = 0;
    if (aqi <= 50) {
        index = 0;
    } else if (aqi <= 100) {
        index = 1;
    } else if (aqi <= 150) {
        index = 2;
    } else if (aqi <= 200) {
        index = 3;
    } else if (aqi <= 300) {
        index = 4;
    } else {
        index = 5;
    }
    return index;
};
/**
 * 获取图例
 * @param {范围值} range 
 * @param {当前值} value 
 */
function getLagend(range, value) {
    let index = 1;
    if (range[0].min <= value && value <= range[0].max) {
        index = 1;
    } else if (range[1].min <= value && value <= range[1].max) {
        index = 2;
    } else if (range[2].min <= value && value <= range[2].max) {
        index = 3;
    } else if (range[3].min <= value && value <= range[3].max) {
        index = 4;
    } else if (range[4].min <= value) {
        index = 5;
    }
    return `leg${index}`;
}

/*Pm25 范围*/
function pm25Range() {
    return [
        { desc: '优', min: 0, max: 34 },
        { desc: '良', min: 35, max: 74 },
        { desc: '轻度污染', min: 75, max: 114 },
        { desc: '中度污染', min: 115, max: 149 },
        { desc: '重度污染', min: 150, max: 200 }
    ];
};

/*PM10 范围*/
function pm10Range() {
    return [
        { desc: '优', min: 0, max: 49 },
        { desc: '良', min: 50, max: 149 },
        { desc: '轻度污染', min: 150, max: 249 },
        { desc: '中度污染', min: 250, max: 349 },
        { desc: '重度污染', min: 350, max: 400 }
    ];
};

/*甲醛 范围*/
function hchoRange() {
    return [
        { desc: '优', min: 0, max: 0.07 },
        { desc: '良', min: 0.08, max: 0.09 },
        { desc: '轻度污染', min: 0.1, max: 0.79 },
        { desc: '中度污染', min: 0.8, max: 4.99 },
        { desc: '重度污染', min: 5, max: 10 }
    ];
};

/*挥发性有机物 范围*/
function tvocRange() {
    return [
        { desc: '优', min: 0, max: 311 },
        { desc: '良', min: 312, max: 559 },
        { desc: '轻度污染', min: 560, max: 999 },
        { desc: '中度污染', min: 1000, max: 2999 },
        { desc: '重度污染', min: 3000, max: 4000 }
    ];
};

/*二氧化碳 范围*/
function co2Range() {
    return [
        { desc: '优', min: 0, max: 699 },
        { desc: '良', min: 700, max: 999 },
        { desc: '轻度污染', min: 1000, max: 1499 },
        { desc: '中度污染', min: 1500, max: 1999 },
        { desc: '重度污染', min: 2000, max: 3000 }
    ];
};

/*室外 PM2.5 范围*/
function oPm25Range() {
    return [
        { desc: '优', min: 0, max: 34 },
        { desc: '良', min: 35, max: 74 },
        { desc: '轻度污染', min: 75, max: 114 },
        { desc: '中度污染', min: 115, max: 149 },
        { desc: '重度污染', min: 150, max: 200 }
    ]
};

/** 室外PM10 范围 */
function oPm10Range() {
    return [
        { desc: '优', min: 0, max: 34 },
        { desc: '良', min: 35, max: 74 },
        { desc: '轻度污染', min: 75, max: 114 },
        { desc: '中度污染', min: 115, max: 149 },
        { desc: '重度污染', min: 150, max: 200 }
    ];
};

/**室外 二氧化氮 范围 */
function oNo2Range() {
    return [{ desc: '优', min: 0, max: 99 },
    { desc: '良', min: 100, max: 199 },
    { desc: '轻度污染', min: 200, max: 699 },
    { desc: '中度污染', min: 700, max: 1199 },
    { desc: '重度污染', min: 1200, max: 3840 }];
};

/*室外  二氧化硫 范围*/
function oSoRange() {
    return [
        { desc: '优', min: 0, max: 149 },
        { desc: '良', min: 150, max: 499 },
        { desc: '轻度污染', min: 500, max: 649 },
        { desc: '中度污染', min: 650, max: 799 },
        { desc: '重度污染', min: 800, max: 2620 }
    ]
};

/**室外 一氧化碳 范围 */
function oCoRange() {
    return [
        { desc: '优', min: 0, max: 4 },
        { desc: '良', min: 6, max: 9 },
        { desc: '轻度污染', min: 10, max: 34 },
        { desc: '中度污染', min: 35, max: 59 },
        { desc: '重度污染', min: 60, max: 150 }
    ];
};

function getstyle(){
    return "gruneback"
}

/**室外  臭氧 范围*/
function oO3Range() {
    return [
        { desc: '优', min: 0, max: 159 },
        { desc: '良', min: 160, max: 199 },
        { desc: '轻度污染', min: 200, max: 299 },
        { desc: '中度污染', min: 300, max: 399 },
        { desc: '重度污染', min: 400, max: 1200 }
    ];
};

/**室外  pm25*/
function getTagByoPm25(pm25) {
    return getLagend(oPm25Range(), pm25);
};
/**  室外PM10*/
function getTagByoPm10(pm10) {
    return getLagend(oPm10Range(), pm10);
};
/**  室外 二氧化氮*/
function getTagByoNo2(no2) {
    return getLagend(oNo2Range(), no2);
};
/**  室外 二氧化硫 */
function getTagByoSo(so) {
    return getLagend(oSoRange(), so);
};
/**  室外 一氧化碳  */
function getTagByoCo(co) {
    return getLagend(oCoRange(), co);
};
/**  室外 臭氧  */
function getTagByoO3(o3) {
    return getLagend(oO3Range(), o3);
};

//PM2.5
function getTagByPm25(pm25) {
    return getLagend(pm25Range(), pm25);
}
//PM10
function getTagByPm10(pm10) {
    return getLagend(pm10Range(), pm10);
}
//甲醛
function getTagByHcho(hcho) {
    return getLagend(hchoRange(), hcho);
}
//挥发性有机物
function getTagByTvoc(tvoc) {
    //0.48*1000/1.233=389ppb
    tvoc = tvoc * 1000 / 1.233;
    return getLagend(tvocRange(), tvoc);
}
//二氧化碳
function getTagByCo2(co2) {
    return getLagend(co2Range(), co2);
}

/*获取所有空气指标颜色 */
function getTagColors() {
    var colorList = ['#8DC120', '#E8BE2C', '#EF8724', '#BF1229', '#5C1E82'];
}

/**
 * 日期格式化
 * @d 日期
 */
function dateFormat(d) {
    var date = new Date(d);
    var y = date.getFullYear();
    var m = padZero(date.getMonth() + 1);
    var d = padZero(date.getDate());
    var h = padZero(date.getHours());
    var minute = padZero(date.getMinutes());
    var s = padZero(date.getSeconds());
    return y + "-" + m + "-" + d + "   " + h + ":" + minute + ":" + s;
};
/**
 * 补零操作
 * @arg 参数
 */
function padZero(arg) {
    if (arg < 10)
        arg = "0" + arg;
    return arg;
};

var $ticker;
/**
 * 获取报警信息
 * @param {站点编号} id 
 * @param {登陆用户} userId 
 */
function updateWarning(id, userId, fn) {
    console.log(1)
};